package com.neutech.variable;

import java.util.Arrays;

/**
 * @author Neuedu-远哥
 * @version 1.0
 * @date 2021/11/11 10:58
 */
public class TwoBallTest {
    public static void main(String[] args) {
        // 双色球的池
        // 红球池
        String[] redPool = new String[33];
        for(int i=0;i<redPool.length;i++){
            redPool[i] = i + 1 + "";
        }
        System.out.println("红球池为：" + Arrays.toString(redPool));
        // 蓝球池
        String[] bluePool = new String[16];
        for(int i=0;i<bluePool.length;i++){
            bluePool[i] = i + 1 + "";
        }
        System.out.println("蓝球池为：" + Arrays.toString(bluePool));
        // 交换次数
        int times = 100;
        // 洗牌的次数
        for (int i = 0; i < times; i++) {
            // 洗牌
            // 取红球池中随机的一个下标  13
            int redPoolIndexRandom = (int)(Math.random() * 33);
//            System.out.println("随机下标为：" + redPoolIndexRandom);
            // 与第一个元素交换arr[0]
            String temp = "";
            temp = redPool[0];
            redPool[0] = redPool[redPoolIndexRandom];
            redPool[redPoolIndexRandom] = temp;
        }
        System.out.println("红球池为：" + Arrays.toString(redPool));
        String[] redBall = new String[6];
        redBall = Arrays.copyOf(redPool,6);
        System.out.println("生成的随机6个红球：" + Arrays.toString(redBall));
        /*Arrays.sort(redBall);
        System.out.println("排序好的6个红球：" + Arrays.toString(redBall));*/
    }
}
